<template>
    <div class="xl-table">
        <xlUntil text="企业档案" @addForm="addForm" :untilVisible="false" :add-btn="false" :queryParam="queryParam" @delBatch="delBatch"
                 @searchKeyWord="searchKeyWord" :searchColumns="columns" :export-xls-data="columns"
                 :export-xls-url="url.exportXlsUrl"></xlUntil>
        <div class="xl-table-content">
            <xlTable
                    :columns="columns"
                    :dataSource="data"
                    rowKey="id"
                    :pagination="pagination"
                    :loading="loading"
                    @change="handleTableChange"
                    bordered
                    :scrollX="900"
                    :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
                >
                <template v-slot:action="scope">
                    <a @click="seeForm(scope.record)">查看</a>
                </template>
            </xlTable>
        </div>
        <xlForm ref="xlForm" @handleOk="handleOk"></xlForm>
        <seeForm ref="seeForm"></seeForm>
    </div>
</template>

<script>
    import xlMixin from '@/components/mixin/index'
    import seeForm from './model/see'
    import {companyCompanyBaseGetAllByCreditCode} from "@/assets/api";
    export default {
        name: "index",
        mixins:[xlMixin],
        data(){
            return{
                columns:[
                    {
                        title: '序号',
                        key: 'rowIndex',
                        align: "center",
                        fixed: 'left',
                        width:'100px',
                        customRender: function (t, r, index) {
                            return parseInt(index) + 1;
                        }
                    },
                    {
                        title: '企业名称',
                        dataIndex: 'name',
                        type:'input'
                    },
                    {
                        title: '企业标签',
                        dataIndex: 'tagNameList',
                        type:'input',//排序
                        customRender: function (t, r, index) {
                            return t.join('、');
                        }
                    },
                    {
                        title: 'I类知产',
                        dataIndex: 'iprOneNum',
                        width:'100px',
                        type:'input.number'
                    },
                    {
                        title: 'II类知产',
                        dataIndex: 'iprTwoNum',
                        width:'100px',
                        type:'input.number'
                    },
                    {
                        title: '注册资本',
                        dataIndex: 'regCapital',
                        type:'input'
                    },
                    {
                        title: '成立时间',
                        dataIndex: 'regDate',
                        type:'date'
                    },
                    {
                        title: '操作',
                        dataIndex: 'action',
                        align: "center",
                        fixed: 'right',
                        width:'150px',
                        scopedSlots: {customRender: 'action'}
                    }
                ],
                url: {
                    list: "/system/api/companyCensus/pageList"
                }

            }
        },
        components:{
            seeForm
        },
        created(){
            this.formatMerge()
            this.pageOnload()
        },
        methods:{
            seeForm(data) {
                // 查看方法触发
                companyCompanyBaseGetAllByCreditCode({
                    param:data.creditCode
                })
                    .then(result=>{
                        this.$refs.seeForm.formatData(result.result)
                    })
            }
        }
    }
</script>

<style scoped lang="less">
    .xl-table{
        .xl-table-content{
            padding: 16px;
        }
    }
</style>
